#include <bits/stdc++.h>
#define rg register
#define IN inline
using namespace std;
const int N=1.1e7+5;
IN int max(rg int a, rg int b) {return a > b ? a : b;}
int len,ans;
char s[N] = {'$'};
int main(){
	fread(s + 1, 1, N, stdin); len = strlen(s + 1);
	for(rg int i = 1, l, r; s[i] && i + (ans >> 1) <= len; ans = max(ans, r - l + 1), i ++) {
    for(l=r=i;s[i]==s[r+1];r++) ;
    for(i=r;s[l-1]==s[r+1];l--,r++);}
	printf("%d\n",ans);
	return 0;
}